﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;

namespace 图片查看
{
    public partial class Form1 : Form
    {

        ImgPath ImgPaths = new ImgPath(@"c:\AAA");
        List<string> list = new List<string>();
        public Form1()
        {
            InitializeComponent();

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string[] files = Directory.GetFiles(@"c:\AAA", "*.*");
            for(var i = 0; i < files.Length; i++)
            {
                string filesname = Path.GetFileName(files[i]);
                lbpaths.Items.Add(filesname);
                list.Add(files[i]);
            }
        }

        private void lbpaths_SelectedIndexChanged(object sender, EventArgs e)
        {
            pictureBox1.Image = Image.FromFile(list[lbpaths.SelectedIndex]);
        }
    }
}
